package com.wind.pojo;

public class Result {
    private String msg;
    private Object data;
    private int code;
    public Result(String msg, Object data, int code) {
        this.msg = msg;
        this.data = data;
        this.code = code;
    }
    public Result() {
    }
    public static Result success(String msg, Object data) {
        return new Result(msg, data, 200);
    }

    public static Result success(String msg) {
        return new Result(msg, null, 200);
    }

    public static Result success() {
        return new Result("success", null, 200);
    }

    public static Result error(String msg, Object data, int code) {
        return new Result(msg, data, code);
    }

    public static Result error(String msg, int code) {
        return new Result(msg, null, code);
    }

    public static Result error(String msg) {
        return new Result(msg, null, 500);
    }

    public static Result error() {
        return new Result("系统错误", null, 500);
    }

    public String getMsg() {
        return msg;
    }
    public void setMsg(String msg) {
        this.msg = msg;
    }
    public Object getData() {
        return data;
    }
    public void setData(Object data) {
        this.data = data;
    }
    public int getCode() {
        return code;
    }
    public void setCode(int code) {
        this.code = code;
    }
    @Override
    public String toString() {
        return "Result{" +
                "msg='" + msg + '\'' +
                ", data=" + data +
                ", code=" + code +
                '}';
    }
}
